import { find } from '@/services/student';
import { useEffect, useState } from 'react';
import Manage from '../index';
import List from './list';
function Student({students}:any){
    // const [students,setStudents] = useState([]);
    // const show = async() => {
    //     let data = await find();
    //     setStudents(data.rows);
    // }
    // useEffect(() => {
    //     show();
    // },[])
    return <Manage>
        <div>
            <h2>学生管理</h2>
            <List students={students}></List>
        </div>
    </Manage>
}
export async function getStaticProps(context:any) {
    let res = await fetch("http://localhost:3001/students");
    let data = await res.json();
    return {
      props: {students:data.rows}, // will be passed to the page component as props
    }
}
export default Student;